<template>
    <div class="login-main">
        <div class="find-pwd-main">
            <div class="find-pwd-box">
                <div class="title">
                    找回密码
                    <span>
                        已有帐号去
                        <router-link to="/login">登录</router-link>
                    </span>
                </div>
                <div class="find-pwd-body">
                    <p class="info">我们已向您的注册邮箱
                        <span>{{this.$route.query.emailAddress}}</span><br>发送了一封密码找回邮件，请您注意接收邮件！</p>
                    <div class="form-group">
                        <button @click="goToEmial">
                            去邮箱激活
                        </button>
                    </div>
                    <p class="hint">请注意查收邮件,并按照邮件中的提示操作,完成安全认证。<br>并没有收到邮件？<span @click="sendEmialAgain()">重新发送</span></p>
                </div>
            </div>
            <div class="copyright">
                Copyright © 2017 上海企想信息技术有限公司. All rights reserved.
            </div>
        </div>

    </div>
</template>

<script>
export default {
   
  methods: {
    goEmial($mail) {
        console.log($mail)
      let $t = $mail.split("@")[1];
      $t = $t.toLowerCase();
      console.log($t);
      if ($t == "163.com") {
        return "mail.163.com";
      } else if ($t == "vip.163.com") {
        return "vip.163.com";
      } else if ($t == "126.com") {
        return "mail.126.com";
      } else if ($t == "qq.com" || $t == "vip.qq.com" || $t == "foxmail.com") {
        return "mail.qq.com";
      } else if ($t == "gmail.com") {
        return "mail.google.com";
      } else if ($t == "sohu.com") {
        return "mail.sohu.com";
      } else if ($t == "tom.com") {
        return "mail.tom.com";
      } else if (
        $t == "vip.sina.com" ||
        $t == "sina.com.cn" ||
        $t == "sina.com"
      ) {
        return "mail.sina.com.cn";
      } else if ($t == "tom.com") {
        return "mail.tom.com";
      } else if ($t == "tom.com") {
        return "mail.tom.com";
      } else if ($t == "yeah.net") {
        return "www.yeah.net";
      } else if ($t == "21cn.com") {
        return "mail.21cn.com";
      } else if ($t == "bizideal.com") {
        return "mail.bizideal.com";
      } else if ($t == "hotmail.com") {
        return "www.hotmail.com";
      } else if ($t == "188.com") {
        return "www.188.com";
      } else if ($t == "189.cn") {
        return "webmail15.189.cn/webmail";
      } else if ($t == "wo.com.cn") {
        return "mail.wo.com.cn/smsmail";
      } else if ($t == "139.com") {
        return "mail.10086.cn";
      } else {
        return "";
      }
   

    },
    goToEmial(){
        window.location.href = `http://${this.goEmial(this.$route.query.emailAddress)}`
    },
    sendEmialAgain() {
      this.$ajax
        .post(
          "/api/login/info/sendEmail",
          `email=${this.$route.query.emailAddress}`
        )
        .then(response => {
          if (response.data.code == 1) {
            this.$Modal.success({
              title: "成功",
              content: "发送成功！"
            });
          } else {
            this.$Modal.error({
              title: "错误",
              content: response.data.msg
            });
          }
        })
        .catch(error => {
          this.$Modal.error({
            title: "错误",
            content: error
          });
        });
    }
  }
};
</script>

<style>

</style>
